#!/usr/bin/env python
# -*- coding:utf-8 -*-
#encoding=utf-8

###------------------------------------------------------------------------
### 日志配置 
###------------------------------------------------------------------------

### 运行日志记录目录 ###
import os
self_log_dir = os.path.join(os.path.dirname(__file__), "log")
### 本程序是否进行日志记录 ###
IS_LOG = True
### ini 配置文件目录 ###
ini_config_file = 'D:\\PyWork\\rdminelog\\conf.ini'

### 路径配置
__DIRS = {
         "ADLOG" : "E:\\daiminWorks\\pywork\\hit.eflygame.com.access.log\\",
         "GM"    : "E:\\daiminWorks\\pywork\\eflyminelog\\glogs\\",
         "SDK"   : "D:\\PyWork\\rdminelog\\glogs\\sdklog\\",
        }

__INTERFACE_HOST = 'http://localhost'

def __h(u):
    return '%s%s' %(__INTERFACE_HOST, u)

### 全局配置字典 ###
G_CFG  = {}

###-----------------------------------------------------------------------------------------------
### 业务逻辑模块
###-----------------------------------------------------------------------------------------------

MODELS = {
    "ADLOG" : {
            "dir"               : __DIRS['ADLOG'],
            "file_pattern"      : r'^[\w\.]+_{pasdayfmt}\.\w+|\d+_{pasdayfmt}_\w+$',
            'pasdayfmt'         : ['%y%m%d', '%Y%m%d'],
            "line_pattern"      : r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(.+)\] "(.+)" (\d{3}) (\d+) "(.+)" "(.+)"$',
            "MOBILE_AGENT"   : {
                                'ios'     : ('iOS', 'iPhone', 'iPod', 'iPod'),
                                'android' : ('Android',),
                                'wp'      : ('Windows Phone', 'WP7', 'WP8'),
                                'else'    : ('BlackBerry', 'Symbian', 'Nokia', 'SAMSUNG', 'SonyEricsson', 'Mobile', 'J2ME', 'Opera Mini')
                                },
            'MEDIAS'         : {
                                'tenxun' : 'tx',
                                'baidu'  : 'baidu',
                                },
           "interfaces"      : {
                 "adjcsjfx"      :
                     {
                    "interface"      : __h("/interface/interface.php"),
                    "id"             : 4,
                    'period'         : 'd',
                    "params"         : ('cdate', 'cdevice', 'cgame', 'cperiod', 'cmedia', 'djs'),
                    },
                "ggfxss":
                    {                                    
                    "interface"      : __h("/interface/interface.php"),
                    "id"             : 8,
                    'period'         : 'd',
                    "params"         : ('cdate', 'cdevice', 'cgame', 'cperiod', 'cmedia', 'ls', 'sb', 'bse', 'sesl', 'sles', 'ese4', 'type', 'zsum',),
                    'times'          : {
                                         'ls'  : (0, 4) ,
                                         'sb'  : (4, 8),
                                         'bse' : (8, 12),
                                         'sesl': (12, 16),
                                         'sles': (16, 20),
                                         'ese4': (20, 24),
                                         
                                        },
                     'gamesize'     : {'ddd': 45000000,}
                    }
             },
            
            },
    "GM" :  {
            "dir"            : __DIRS['GM'],
            "games"          :{
                                "ddd" : {
                                           "file_pattern": r'^act.game.ddd.{pasdayfmt}.log$',
                                           "log_split"   : ",",
                                           "tag_index"   : 1,
                                           "channels" :{
                                                        "2222": u"百度CPD05",
                                                        "2223": u"百度关键词01",
                                                        "2224": u"百度关键词02",
                                                        "2225": u"百度关键词03",
                                                        "2226": u"百度关键词04",
                                                        "2227": u"百度关键词05",
                                                        "2228": u"深圳包子科技",
                                                        "2229": u"zss2",
                                                        "2230": u"zss3",
                                                        "2231": u"zss1",
                                                        "2232": u"wwxx1",
                                                        "2233": u"wwxx2",
                                                        "2234": u"wwxx3",
                                                        "2235": u"tjjz",
                                                        "2236": u"zhcm01",    
                                                        "2237": u"zhcm02",    
                                                        "2238": u"awcm",
                                                        "2239": u"wpsj",
                                                        "2240": u"春霖易连",
                                                        "2241": u"触控科技",
                                                        "2242": u"hxg",
                                                        "2243": u"天天动听",
                                                        "2244": u"inmobi",
                                                        "2245": u"Admob", 
                                                        "2246": u"亿动智道",
                                                        "2247": u"亿动智道02",
                                                        "2248": u"亿玛传媒",
                                                        "2249": u"鹏锐信息",
                                                        "2250": u"欢乐时光",
                                                        "2251": u"91点金",
                                                        "2252": u"有为传媒",
                                                        "2253": u"91",
                                                        },
                                                     "interfaces"      : {
                                                                 "gamedata"      :
                                                                     {
                                                                    "interface"      : __h("/interface/interface.php"),
                                                                    "id"             : 5,
                                                                    'period'         : 'd',
                                                                    "platform"       : 'android',
                                                                    "params"         : {
                                                                                        'keys'  : ('cdate', 'cdevice', 'cchannel', 'cserver', 'cgame','cperiod',),
                                                                                        'items': ('newreg', 'notreg','newrole', 'loginnum', 'loginnum_new', 'login_sum',\
                                                                                                   'user_hy', 'czje', 'czbs','xzcffyh', 'xczrs', 'qytxdryh', 'qytxdryhjthdl', 'czrs'),
                                                                                       },
                                                                    },
                                                                "czgl":
                                                                    {                                    
                                                                     "interface"      : __h("/interface/interface.php"),
                                                                     "id"             : 7,
                                                                     "platform"       : 'android',
                                                                     
                                                                    }
                                                                 },
                                         },
                              },
             
            "db"             : {
                                'prefix'      : 'efly', 
                                }
            
           },
          
          "SDK" :  {
              "dir"            : __DIRS['SDK'],
              "file_pattern"   : r'^act.\w+.\w+.{pasdayfmt}.log$',
              "log_split"      : '\t',
              "interfaces"     : {
                    "gamedatasdk"      :
                    {
                        "interface"      : __h("/interface/interface.php"),
                        "id"             : 9,
                        'period'         : 'd',
                        "params"         : {
                                            'keys'  : ('cdate', 'cdevice', 'cchannel', 'cserver', 'cgame','cperiod',),
                                            'items': ('newreg', 'notreg','newrole', 'loginnum', 'loginnum_new', 'login_sum',\
                                                       'user_hy', 'czje', 'czbs','xzcffyh', 'xczrs', 'qytxdryh', 'qytxdryhjthdl', 'czrs'),
                                           },
                    },
             },
             
            "db"             : {
                                'prefix'      : 'efly', 
                                }
            
           }
    }
    


